{% extends "base.html" %}

{% block title %}管理面板 - 汽车品牌互动平台{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h1>管理面板</h1>
    <span class="text-muted">登录身份：管理员 ({{ session['username'] }})</span>
</div>

<!-- 数据统计卡片 -->
<div class="row mb-5">
    <div class="col-md-4 mb-3">
        <div class="card bg-primary text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <h5 class="card-title">总用户数</h5>
                    <i class="bi bi-people fs-2"></i>
                </div>
                <p class="card-text fs-3 mt-3">{{ total_users }}</p>
                <a href="{{ url_for('admin_users') }}" class="text-white stretched-link">查看全部用户 →</a>
            </div>
        </div>
    </div>
    <div class="col-md-4 mb-3">
        <div class="card bg-success text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <h5 class="card-title">汽车品牌数</h5>
                    <i class="bi bi-car-front fs-2"></i>
                </div>
                <p class="card-text fs-3 mt-3">{{ total_brands }}</p>
                <a href="{{ url_for('admin_brands') }}" class="text-white stretched-link">管理品牌 →</a>
            </div>
        </div>
    </div>
    <div class="col-md-4 mb-3">
        <div class="card bg-info text-white h-100">
            <div class="card-body">
                <div class="d-flex justify-content-between align-items-center">
                    <h5 class="card-title">总评论数</h5>
                    <i class="bi bi-chat-left fs-2"></i>
                </div>
                <p class="card-text fs-3 mt-3">{{ total_comments }}</p>
                <a href="{{ url_for('admin_comments') }}" class="text-white stretched-link">管理评论 →</a>
            </div>
        </div>
    </div>
</div>

<!-- 快捷操作 -->
<div class="row mb-5">
    <div class="col">
        <div class="card">
            <div class="card-header">
                <h5 class="mb-0">快捷操作</h5>
            </div>
            <div class="card-body">
                <div class="d-flex flex-wrap gap-3">
                    <a href="{{ url_for('add_brand') }}" class="btn btn-primary">
                        <i class="bi bi-plus-circle me-1"></i>添加新品牌
                    </a>
                    <a href="{{ url_for('admin_users') }}" class="btn btn-secondary">
                        <i class="bi bi-people me-1"></i>管理用户
                    </a>
                    <a href="{{ url_for('admin_comments') }}" class="btn btn-secondary">
                        <i class="bi bi-chat-left-text me-1"></i>审核评论
                    </a>
                    <a href="{{ url_for('index') }}" class="btn btn-outline-primary">
                        <i class="bi bi-eye me-1"></i>访问前台
                    </a>
                    <a href="{{ url_for('logout') }}" class="btn btn-outline-danger">
                        <i class="bi bi-box-arrow-right me-1"></i>退出登录
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 最近动态 -->
<div class="row">
    <div class="col">
        <div class="card">
            <div class="card-header d-flex justify-content-between align-items-center">
                <h5 class="mb-0">最近动态</h5>
                <small class="text-muted">展示最近10条系统操作记录</small>
            </div>
            <div class="card-body">
                <div class="list-group">
                    <!-- 动态内容通过JS从后端加载（这里用静态示例） -->
                    <div class="list-group-item">
                        <div class="d-flex justify-content-between">
                            <div>
                                <strong>张三</strong> 发表了新评论
                            </div>
                            <small class="text-muted">10分钟前</small>
                        </div>
                    </div>
                    <div class="list-group-item">
                        <div class="d-flex justify-content-between">
                            <div>
                                <strong>系统</strong> 自动初始化了5个品牌数据
                            </div>
                            <small class="text-muted">1小时前</small>
                        </div>
                    </div>
                    <div class="list-group-item">
                        <div class="d-flex justify-content-between">
                            <div>
                                <strong>李四</strong> 对"星驰汽车"投了支持票
                            </div>
                            <small class="text-muted">2小时前</small>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{% endblock %}